package com.muyu.user.controller;

import java.util.List;

import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.poi.ExcelUtil;
import com.muyu.common.core.web.controller.BaseController;
import com.muyu.common.log.annotation.Log;
import com.muyu.common.log.enums.BusinessType;
import com.muyu.common.security.annotation.RequiresPermissions;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.muyu.user.domain.SysUserBalance;
import com.muyu.user.domain.req.SysUserBalanceQueryReq;
import com.muyu.user.domain.model.SysUserBalanceQueryModel;
import com.muyu.user.domain.model.SysUserBalancePageQueryModel;
import com.muyu.user.domain.resp.SysUserBalancePageResp;
import com.muyu.user.service.SysUserBalanceService;
import com.muyu.common.core.web.page.DataPageResp;
import com.muyu.common.core.web.page.PageQueryModel;

/**
 * 余额变动Controller
 *
 * @author liuguoqiang
 * @date 2025-09-18
 */
@RestController
@RequestMapping("/balance")
@Tag(name = "余额变动", description = "余额变动控制层")
public class SysUserBalanceController extends BaseController {

    /**
    * 余额变动业务层
    */
    @Autowired
    private SysUserBalanceService sysUserBalanceService;

    /**
     * 查询余额变动列表
     */
    @Operation(summary = "获取余额变动列表", description = "获取余额变动列表")
    @RequiresPermissions("user:balance:list")
    @GetMapping("/list")
    public Result<DataPageResp<SysUserBalancePageResp>> list(SysUserBalanceQueryReq sysUserBalanceQueryReq) {
        PageQueryModel<SysUserBalancePageQueryModel> pageQueryModel = sysUserBalanceService.pageQuery(SysUserBalanceQueryModel.reqBuild(sysUserBalanceQueryReq));
        return Result.success(DataPageResp.of(pageQueryModel).cover(SysUserBalancePageResp::infoBuild));
    }

}
